﻿using System;
using System.Linq;
using OpenAuth.Repository.Core;
using OpenAuth.Repository.Domain;
using OpenAuth.Repository.Interface;

namespace OpenAuth.App
{
    /// <summary>
    /// 业务层基类，UnitWork用于事务操作，Repository用于普通的数据库操作
    /// <para>如用户管理：Class UserManagerApp:BaseApp<User></para>
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class CisBaseApp<T> where T:class
    {
        /// <summary>
        /// 用于事务操作
        /// </summary>
        /// <value>The unit work.</value>
        //protected IUnitWork UnitWork;

        public CisBaseApp(ICisRepository<T> repository)
        {
           
            Repository = repository;
        }

        /// <summary>
        /// 用于普通的数据库操作
        /// </summary>
        /// <value>The repository.</value>
        protected ICisRepository<T> Repository;

        /// <summary>
        /// 按id批量删除
        /// </summary>
        /// <param name="ids"></param>
        //public void Delete(string[] ids)
        //{
        //    Repository.Delete(u => ids.Contains(u.Id));
        //}

        //public T Get(string id)
        //{
        //    return Repository.FindSingle(u => u.Id == id);
        //}

       
    }
}
